package com.hopedove.net;

/***
 *  相关设置
 */
public final class Settings {
    private Settings() {
    }

    static class NetConfig {
        final public String path;
        final public String host;
        final public String url;

        public NetConfig(String host, String path) {
            this.host = host;
            this.path = path;
            this.url = host + path;
        }
    }

    private static NetConfig configForLocalTest = new NetConfig("http://192.168.1.221:8080", "/szerp/PublicWebServiceInterface");
    private static NetConfig configForTest = new NetConfig("http://47.105.107.250:8082", "/szerp/PublicWebServiceInterface");
    private static NetConfig configForProduction = new NetConfig("http://10.10.151.74:8080", "/szerp/PublicWebServiceInterface?wsdl");
    private static NetConfig type2ForTest = new NetConfig("http://47.105.107.250:8082", "/szerp/PublicWebServiceInterface?wsdl");
    private static NetConfig type2ForLocalTest = new NetConfig("http://192.168.1.103:8080", "/szerp/PublicWebServiceInterface?wsdl");

    public static String getUrl(String type) {
        if ("normal".equals(type)) {
            if (BuildConfig.DEBUG) {
                return configForTest.url;
            } else {
                return configForProduction.url;
            }
        } else {
            if (BuildConfig.DEBUG) {
                return type2ForTest.url;
            } else {
                return configForProduction.url;
            }
        }
    }

    public static String getUrl() {
        return getUrl("normal");
    }

    public static int TIMEOUT = 5000;
    public static String NAME_SPACE = "http://service.commons.hoperun.com/";
}
